﻿<UserControl x:Class="Client.View.FizickoLiceListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:converters="clr-namespace:Client.Converters"
             >
    <UserControl.Resources>
        <ResourceDictionary>
            <converters:PolConverter x:Key="PolConverter"/>
            <converters:FizickoLiceListFatherNameConverter x:Key="fatherNameConverter"/>
            <converters:FizickoLiceListMotherNameConverter x:Key="motherNameConverter"/>
            <converters:ComboBoxItemConverter x:Key="DocumentTypeConverter"/>            
        </ResourceDictionary>
    </UserControl.Resources>    
    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <ListView Grid.Row="1" Grid.Column="1"
                      ScrollViewer.VerticalScrollBarVisibility="Auto" 
                      ItemsSource="{Binding CollectionItems}"
                      SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
                      ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}"
                      >
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Slika">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <Image Width="48" Height="48" Source="{Binding Slika}"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="Ime" DisplayMemberBinding="{Binding Ime}"/>
                    <GridViewColumn Header="Prezime" DisplayMemberBinding="{Binding Prezime}"/>
                    <GridViewColumn Header="JMBG" DisplayMemberBinding="{Binding IdentifikacioniBroj}" />
                    <GridViewColumn Header="Pol" Width="80">
                        <GridViewColumn.DisplayMemberBinding>
                            <Binding Path="Pol" Converter="{StaticResource PolConverter}" />
                        </GridViewColumn.DisplayMemberBinding>
                    </GridViewColumn>
                    <GridViewColumn Header="Datum rodjenja" DisplayMemberBinding="{Binding DatumRodjenja, StringFormat='dd.MM.yyyy'}" />
                    <GridViewColumn Header="Otac" DisplayMemberBinding="{Binding Otac, Converter={StaticResource fatherNameConverter}}" />
                    <GridViewColumn Header="Majka" DisplayMemberBinding="{Binding Majka, Converter={StaticResource motherNameConverter}}" />
                    <GridViewColumn Header="Identifikacioni dokument" DisplayMemberBinding="{Binding IdentifikacioniDokument.Naziv, Converter={StaticResource DocumentTypeConverter}}"/>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>
